package com.xiebang.extenddemo;

/**
 * Created by xiebang
 * Description
 * User:小谢
 * Date:2021-09-10
 * Time:17:12
 */
class Animal1{
    public String name;
    public int age;
    public Animal1(String name){
        this.name = name;
    }
    public void eat(){
        System.out.println(name + ":吃饭饭！");
    }
    public void bark(){
        System.out.println(name + ": 叫！！！");
    }
}
class Cat1 extends Animal1{
    public Cat1(String name){
        super(name);//显示的调用父类的构造方法。 以前没有 编译器自己默认
    }
    public void upTree(){
        System.out.println(name + ":上树！");
    }
}

class Dog1 extends Animal1{

    public String color;

    public Dog1(String name) {
        super(name);
    }
}
public class Test2 {
    public static void main(String[] args) {
        Cat1 cat1 = new Cat1("haha");
        cat1.upTree();
    }
}
